//
//  UIBarButtonItem+Extension.swift
//  KVBestMicroblog
//
//  Created by 李康卫 on 16/7/31.
//  Copyright © 2016年 李康卫. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    convenience init(imageName: String,target: AnyObject?, action: Selector) {
        
        let button = UIButton(type: UIButtonType.Custom)
        button.sizeToFit()
        
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        button.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        
        button.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        
        
        self.init(customView:button)
    }
}
